package com.group9.controller;

import com.group9.dto.UpdateInfo;
import com.group9.service.ViewInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * Created by 45865 on 2020/5/28.
 */
@Controller
@RequestMapping("view")
public class ViewInfoController {

    @Autowired
    ViewInfoService viewInfoService;

    @RequestMapping("info")
    @ResponseBody
    public UpdateInfo viewInfo(HttpSession session){

        String loginName = (String) session.getAttribute("loginName");
        UpdateInfo updateInfo = viewInfoService.viewInfoPersonal(loginName);
        if (null != updateInfo){
            return updateInfo;
        }else {
            return null;
        }

    }
}
